package com.qf.team2.netdisc.admin.controller;

import com.qf.team2.netdisc.admin.service.AdminQueryService;
import com.qf.team2.netdisc.common.base.BaseController;
import com.qf.team2.netdisc.common.pojo.vo.RespResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 管理员查询业务接口
 *
 * @author Simon_Wong
 * @since 2021/5/26 14:50
 */
@Controller
@RequestMapping("/admin")
@Api(tags = "管理员查询业务接口")
public class AdminQueryController extends BaseController<Object> {

    @Autowired
    private AdminQueryService adminQueryService;

    @ResponseBody
    @RequestMapping(value = "/allUser", method = RequestMethod.POST)
    @ApiOperation("获取所有用户")
    public RespResultVO<Object> allUser() {
        return successResp(adminQueryService.getAllUser(), "查询成功");
    }

    @ResponseBody
    @RequestMapping(value = "/allDocumentOfUser", method = RequestMethod.GET)
    @ApiOperation("获取特定用户所有的文件")
    public RespResultVO<Object> allDocumentOfUser(@RequestParam("userId") Integer userId) {
        return successResp(adminQueryService.getAllDocumentOfUser(userId), "查询成功");
    }
}
